create or replace package plobj_api
as

       type value_pointer is record
       (
            handle pls_integer,
            type   pls_integer -- see numbers of v_*_values
       );

       function new_object
       return pls_integer;
       
       function get_value_pointer (p_object_handle in pls_integer,
                                   p_field_name in varchar2)
       return value_pointer;

       procedure free_object(p_object_handle pls_integer);
       
       procedure copy (p_object_handle_from pls_integer,
                       p_object_handle_to   pls_integer);

       procedure rename_field(p_object_handle pls_integer, 
                              p_old_name      varchar2, 
                              p_new_name      varchar2);
       
       procedure remove_field(p_object_handle pls_integer, 
                              p_field_name      varchar2);
       
       procedure copy_field(p_object_handle pls_integer, 
                            p_name          varchar2, 
                            p_new_name      varchar2);
                              
       procedure copy_field(p_object_handle_f pls_integer, 
                            p_object_handle_t pls_integer, 
                            p_field_name      varchar2);
                            
       procedure set_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   date);

       procedure set_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   number);

       procedure set_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   varchar2);

       procedure set_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   clob);
                                  
       procedure set_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   blob);

       procedure get_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   out nocopy date);

       procedure get_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   out nocopy number);

       procedure get_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   out nocopy varchar2);

       procedure get_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   out nocopy clob);
                                  
       procedure get_field(p_object_handle pls_integer,
                           p_field_name    varchar2,
                           p_field_value   out nocopy blob);
                           
       /*function get_field_type(p_object_handle pls_integer,
                               p_field_name    varchar2)
       return pls_integer;*/
       function is_field_null(p_object_handle pls_integer,
                              p_field_name    varchar2)
       return boolean;
                                  
       function get_date_field(p_object_handle pls_integer,
                               p_field_name    varchar2)
       return date;

       function get_number_field(p_object_handle pls_integer,
                                 p_field_name    varchar2)
       return number;

       function get_varchar2_field(p_object_handle pls_integer,
                                   p_field_name    varchar2)
       return varchar2;

       function get_clob_field(p_object_handle pls_integer,
                               p_field_name    varchar2)
       return clob;

       function get_blob_field(p_object_handle pls_integer,
                               p_field_name    varchar2)
       return blob;

       function get_date_value(p_value_handle pls_integer,
                               p_value_type    varchar2)
       return date;

       function get_number_value(p_value_handle pls_integer,
                                 p_value_type    varchar2)
       return number;

       function get_varchar2_value(p_value_handle pls_integer,
                                   p_value_type    varchar2)
       return varchar2;

       function get_clob_value(p_value_handle pls_integer,
                               p_value_type    varchar2)
       return clob;

       function get_blob_value(p_value_handle pls_integer,
                               p_value_type    varchar2)
       return blob;

       procedure dump_object(p_object_handle pls_integer);
       
       function to_clob(p_object_handle pls_integer)
       return clob;
       
       function eval (p_object_handle in number, p_str in varchar2)
       return varchar2;
       
       procedure nextval (p_object_handle in number, p_seq in varchar2, p_field_name in varchar2);
       
end plobj_api;
/
